/**
 * HSChart Struct Class
 * 图形配置类
 * Rabbit 2013-3-3
 *
 */
// Ext.namespace('webapp.common');

var HChartStruct = function(cfgObj) {
	/*********************************公共属性 begin*******************************/
	//标题
	this.title = cfgObj.title != undefined ? cfgObj.title : '';
	//副标题
	this.subtitle = cfgObj.subtitle != undefined ? cfgObj.subtitle : '';
	//图表数据
	this.chartData = cfgObj.chartData ? cfgObj.chartData : null;
	//图形类型
	this.chartType = cfgObj.chartType ? cfgObj.chartType : 'line';
	//[line, spline, area, areaspline, column, bar, pie, scatter]
	//图形显示的数据类型[traffic:流量,forward:包转发率,percent:百分比,capacity:容量,number:个数、数量]
	this.displayDataType = cfgObj.displayDataType ? cfgObj.displayDataType : 'number';
	//目前只有[traffic,percent,number]
	//渲染到容器
	this.renderTo = cfgObj.renderTo ? cfgObj.renderTo : null;

	//颜色列表
	this.colors = null;
	//["#D5494A","#277EDE","#F3CD08","#808CC1","#DA65B7","#8F9663","#BF0BCE","#0C3F4E","#682408","#00AB38","#F08ED9","#9D080D","#A186BE","#F83A1A","#572219","#71F4E0","#83F471","#F471E9","#E6F471","#454D4E","#FF5904"];

	//轴类型
	this.xAxisType = cfgObj.xAxisType != undefined ? cfgObj.xAxisType : 'linear';
	//横轴显示坐标间隔
	this.xAxisLabelsStep = cfgObj.xAxisLabelsStep != undefined ? cfgObj.xAxisLabelsStep : 1;
	//['linear','datetime']
	//柱状图分类轴
	this.categories = cfgObj.categories != undefined ? cfgObj.categories : [];
	//时间轴格式
	this.dateTimeLabelFormats = cfgObj.dateTimeLabelFormats != undefined ? cfgObj.dateTimeLabelFormats : {
		second : '%H:%M:%S',
		minute : '%M:%S',
		hour : '%H:%M',
		day : '%m-%d',
		week : '%Y-%m-%d',
		month : '%Y-%m',
		year : '%Y'
	};
	//second: '%H:%M:%S',	minute: '%e. %b %H:%M',	hour: '%b/%e %H:%M', day: '%e日/%b', week: '%e. %b', month: '%b %y', year: '%Y'	};
	/*{second: '%H:%M:%S', minute: '%H:%M', hour: '%H:%M', day: '%e. %b', week: '%e. %b', month: '%b \'%y', year: '%Y'};*/

	//Y轴标题
	this.yAxisTitle = cfgObj.yAxisTitle != undefined ? cfgObj.yAxisTitle : '';
	//Y轴最小值
	this.yAxisMin = cfgObj.yAxisMin != undefined ? cfgObj.yAxisMin : null;
	//Y轴最大值
	this.yAxisMax = cfgObj.yAxisMax != undefined ? cfgObj.yAxisMax : null;
	//Y轴是否允许小数
	this.yAxisAllowDecimals = cfgObj.yAxisAllowDecimals != undefined ? cfgObj.yAxisAllowDecimals : true;

	//单位
	this.unit = cfgObj.unit != undefined ? cfgObj.unit : '';

	//图例显示
	this.enabledLegend = cfgObj.enabledLegend == false ? cfgObj.enabledLegend : true;
	this.legend = cfgObj.legend ? cfgObj.legend : null;

	//是否显示导出、打印图标
	this.enabledExporting = cfgObj.enabledExporting ? cfgObj.enabledExporting : false;

	//是否显示数据提示框
	this.enabledTooltip = cfgObj.enabledTooltip == false ? cfgObj.enabledTooltip : true;
	this.tooltipFormatter = cfgObj.tooltipFormatter ? cfgObj.tooltipFormatter : null;

	//是否显示文字标签
	this.enabledDataLabels = cfgObj.enabledDataLabels != false ? cfgObj.enabledDataLabels : false;

	this.marginTop = cfgObj.marginTop != undefined ? cfgObj.marginTop : null;
	this.marginRight = cfgObj.marginRight != undefined ? cfgObj.marginRight : 50;
	this.marginBottom = cfgObj.marginBottom != undefined ? cfgObj.marginBottom : 70;
	this.marginLeft = cfgObj.marginLeft != undefined ? cfgObj.marginLeft : 80;
	/*********************************公共属性 end*******************************/

	/*********************************柱状图(ColumnChart)属性 begin*******************************/
	//序列名称
	//this.seriesName = cfgObj.seriesName != undefined ? cfgObj.seriesName : '';

	//X轴刻度标签旋转角度
	this.xAxisLabelsRotation = cfgObj.enabledDataLabels != undefined ? cfgObj.enabledDataLabels : 0;
	//柱子点击事件
	this.columnClickHandle = cfgObj.columnClickHandle != undefined ? cfgObj.columnClickHandle : function() {
	};
	/*********************************柱状图(ColumnChart)属性 end*******************************/

	/*********************************饼图(PieChart)属性 begin*******************************/
	//饼图提示数据格式
	this.pointFormat = cfgObj.pointFormat != undefined ? cfgObj.pointFormat : '{series.name}: <b>{point.percentage}%</b>';
	/*********************************饼图(PieChart)属性 end*******************************/

	/*
	 this.chartType = cfgObj.chartType ? cfgObj.chartType : 'line';

	 this.marginTop = cfgObj.marginTop != undefined ? cfgObj.marginTop : 20;
	 this.marginRight = cfgObj.marginRight != undefined ? cfgObj.marginRight : 5;
	 this.marginBottom = cfgObj.marginBottom != undefined ? cfgObj.marginBottom : 5;
	 this.marginLeft = cfgObj.marginLeft != undefined ? cfgObj.marginLeft : 5;

	 //this.colors = ["#FF0F00", "#FF6600", "#FF9E01", "#FCD202", "#F8FF01", "#B0DE09", "#04D215", "#0D8ECF", "#0D52D1", "#2A0CD0", "#8A0CCF", "#CD0D74", "#754DEB", "#DDDDDD", "#999999", "#333333", "#000000", "#57032A", "#CA9726", "#990000", "#4B0C25"];
	 this.colors = ["#D5494A","#277EDE","#F3CD08","#808CC1","#DA65B7","#8F9663","#BF0BCE","#0C3F4E","#682408","#00AB38","#F08ED9","#9D080D","#A186BE","#F83A1A","#572219","#71F4E0","#83F471","#F471E9","#E6F471","#454D4E","#FF5904"];

	 if(cfgObj.colors)
	 this.colors = cfgObj.colors;
	 // scale: 1/1000/1000000...
	 this.scale = cfgObj.scale ? cfgObj.scale : null;

	 //X Axis field
	 this.categoryField = cfgObj.categoryField ? cfgObj.categoryField : '';
	 // this.dataProvider = cfgObj.dataProvider ? cfgObj.dataProvider : null;

	 //X Axis
	 this.categoryAxisParseDates = cfgObj.categoryAxisParseDates != undefined ? cfgObj.categoryAxisParseDates : false;
	 this.categoryAxisMinPeriod = cfgObj.categoryAxisMinPeriod ? cfgObj.categoryAxisMinPeriod : 'DD';
	 this.categoryAxisTitle = cfgObj.categoryAxisTitle ? cfgObj.categoryAxisTitle : '';
	 this.categoryAxisDateFormats = [{
	 period : 'fff',
	 format : 'JJ:NN:SS'
	 }, {
	 period : 'ss',
	 format : 'JJ:NN:SS'
	 }, {
	 period : 'mm',
	 format : 'JJ:NN'
	 }, {
	 period : 'hh',
	 format : 'JJ:NN'
	 }, {
	 period : 'DD',
	 format : 'YYYY-MM-DD'
	 }, {
	 period : 'MM',
	 format : 'MM-DD'
	 }, {
	 period : 'YYYY',
	 format : 'YYYY'
	 }];
	 if(cfgObj.categoryAxisDateFormats)
	 this.categoryAxisDateFormats = cfgObj.categoryAxisDateFormats;
	 this.categoryAxisLabelRotation = cfgObj.categoryAxisLabelRotation != undefined ? cfgObj.categoryAxisLabelRotation : 0;

	 //Y Axis unit: (G/M/K) + (bps/B)...
	 this.valueAxisUnit = cfgObj.valueAxisUnit ? cfgObj.valueAxisUnit : null;
	 this.valueAxisMaximum = cfgObj.valueAxisMaximum ? cfgObj.valueAxisMaximum : null;
	 //int、float
	 this.valueAxisIntegersOnly = cfgObj.valueAxisIntegersOnly != undefined ? cfgObj.valueAxisIntegersOnly : false;
	 //Y Axis ["none", "regular", "100%", "3d"]
	 this.valueAxisStackType = cfgObj.valueAxisStackType ? cfgObj.valueAxisStackType : 'none';
	 this.valueAxisTitle = cfgObj.valueAxisTitle ? cfgObj.valueAxisTitle : '';

	 //序列 ['line', 'column', 'step', 'smoothedLine', 'candlestick', 'ohlc']
	 this.serialGraph = cfgObj.serialGraph ? cfgObj.serialGraph : [];

	 //饼图属性
	 this.titleField = cfgObj.titleField ? cfgObj.titleField : '';
	 this.valueField = cfgObj.valueField ? cfgObj.valueField : '';
	 this.hideLabelsPercent = cfgObj.hideLabelsPercent ? cfgObj.hideLabelsPercent : 0;

	 //图形指示
	 this.showChartCursor = cfgObj.showChartCursor != undefined ? cfgObj.showChartCursor : true;
	 this.chartCursorDateFormat = cfgObj.chartCursorDateFormat ? cfgObj.chartCursorDateFormat : 'YYYY-MM-DD';

	 //图例显示
	 this.showLegend = cfgObj.showLegend != undefined ? cfgObj.showLegend : false;

	 //缩放滚动条
	 this.showScrollbar = cfgObj.showScrollbar != undefined ? cfgObj.showScrollbar : false;
	 */
}